#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define optimize ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define testcase ll t; cin>>t;while(t--){solve();}
#define ub upper_bound
#define lb lower_bound
#define ff first
#define ss second
// #define l s.size()
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define pb push_back
#define re return
#define nl cout<<endl;
#define neg() cout<<-1<<endl;
#define c() cout<<c<<endl;
#define o(n) cout<<n;
#define i(n) ll n;cin>>n;
#define sa(a,n) sort(a,a+n)
#define ra(a,n) reverse(a,a+n)
#define s(x) sort(x.begin(),x.end())
#define rvec(v) reverse(v.begin(),v.end())
#define f(n) for(ll i=0;i<n;i++)
#define f1(n) for(ll i=1;i<n;i++)
#define f2(i,a,b) for(ll i=a;i<b;i++)
#define pa(a,n) for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<endl;
#define pvec(v,n) for(ll i=0;i<n;i++){cout<<v[i]<<" ";}cout<<endl;
#define ppair(v,n) for(ll i=0;i<n;i++){cout<<v[i].ff<<" "<<v[i].ss<<" , ";}cout<<endl;
#define str(s) string s;cin>>s;
#define arr(a,n) ll a[n];for(ll i=0;i<n;i++)cin>>a[i];
#define vec(v,n) vector<ll> v;for(ll i=0;i<n;i++){ll x;cin>>x;v.pb(x);}
#define vec1(v,b) vector<ll> v(b,0);for(ll i=1;i<=n;i++){ll x;cin>>x;v[i]=x;}
// mx=*max_element(a,a+n)
//index=upper_bound(a,a+n,x)-a;
// A=65 Z=90
// a=97 z=122
//--------------------------------------------------------------------------------------------------------------------*/
const ll N =2e5+5;
ll presum1[N];
ll presum2[N];
void solve(){
vector<pair<ll,ll>> vp;
vector<ll> b;
map<ll,ll> m;
ll c=0,sum=0;
ll maxi=INT_MAX;
ll ans=0;
/*------------------------------------------------------------------------*/
i(n);
arr(a,n);
sa(a,n);
if(a[0]!=a[1]){yes;re;}
f(n){
if(a[i]%a[0]){yes;re;}
}
no;re;
/*---------------------------------------------------------------------------------*/
}
int main(){
optimize;
testcase;
// solve();
}
165B - Burning Midnight Oil | 17A - Noldbach problem |
1350A - Orac and Factors | 1373A - Donut Shops |
26A - Almost Prime | 1656E - Equal Tree Sums |
1656B - Subtract Operation | 1656A - Good Pairs |
1367A - Short Substrings | 87A - Trains |
664A - Complicated GCD | 1635D - Infinite Set |
1462A - Favorite Sequence | 1445B - Elimination |
1656C - Make Equal With Mod | 567A - Lineland Mail |
1553A - Digits Sum | 1359B - New Theatre Square |
766A - Mahmoud and Longest Uncommon Subsequence | 701B - Cells Not Under Attack |
702A - Maximum Increase | 1656D - K-good |
1426A - Floor Number | 876A - Trip For Meal |
1326B - Maximums | 1635C - Differential Sorting |
961A - Tetris | 1635B - Avoid Local Maximums |
20A - BerOS file system | 1637A - Sorting Parts |